<?php

/*
 * 基类文件 baoyu.inc.php
 * 
 */
class baoyu extends yatou
{
    var $get = array();
    
    var $post = array();
    
    //自动执行函数
    function BaoYu()
    {
        parent::__construct($get,$post);
        $this->InitGet();
    }
    //模板初始化
    function InitGet()
    {
        $queryString = $_SERVER['QUERY_STRING'];
        
        if(!empty($queryString))
        {
            $this->get = explode('-',$queryString);
        }
        if(@$this->get[0]=="")
        {
            $this->get[0] = 'index';
        }

        if(@$this->get[1]=='')
        {
            $this->get[1] = 'Action';
        }
        
        $this->post = $_POST;
    }
    //初始化操作
    function LoadAction($controlDir)
    {
        $controlFile = $controlDir.$this->get[0].'.php';
        if(file_exists($controlFile))
        {
            require_once($controlFile);
        }
        else
        {
            $this->showmsg('方法不存在','','');
            exit();
        }
    }
    //执行类中的函数
    function doAction()
    {
        $method = $this->get[1];
        $controlObj = new  wyouyu($this->get,$this->post);
        if(method_exists($controlObj,$method))
        {
            $controlObj->$method();
        }
        else
        {
            $this->showmsg('操作不存在','','');
            exit();
        }
    }
    
}
?>
